﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PMSSys
{
    public partial class TreatmentView : Form
    {
        public TreatmentView(string tplan_id, treatmentController tmcontroller)
        {
            InitializeComponent();
            tmObject = new TM();
            tcontrol = tmcontroller;
            if (addMode = String.IsNullOrEmpty(tplan_id))
            {
            }
            else
            {
                tmObject.TmID = int.Parse(tplan_id);
                tcontrol.objectFiller(tmObject);
                dateTimePicker1.Value = tmObject.TMDate;
                comboBox1.Text = tmObject.TestType;
                textBox1.Text = tmObject.Comments;
                isModified = false;
            }

        }
        private bool isModified = false;
        private TM tmObject;
        private treatmentController tcontrol;
        private bool addMode;
        private void closeLogic(object sender, EventArgs e)
        {
            this.Close();
        }

        private void modifiedChecker(object sender, EventArgs e)
        {
            isModified = true;
        }

        private void TreatmentView_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (isModified)
            {
                DialogResult res = uiUtility.confirmSaveDialog();
                if (res != DialogResult.Cancel)
                {
                    if (res == DialogResult.Yes)
                    {
                        if (comboBox1.Text != String.Empty)
                        {

                            if (addMode)
                            {
                            }
                            else
                            {
                            }
                        }
                    }

                }
                else
                    e.Cancel = true;
            }

        }

        private void TreatmentView_Load(object sender, EventArgs e)
        {
            ToolTip t1 = uiUtility.tooltips();
            t1.SetToolTip(this.button6, "Back");
        }
    }
}
